package com.springcloud.alibaba.stream.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @Author:RenPu
 * @Date: 2020/7/2 13:09
 * @Version: 1.0
 * @description:
 */
@Component
@EnableBinding(Sink.class)
public class ConsumerStreamController {

    @Value("${server.port}")
    private  String SERVER_PORT;

    @StreamListener(Sink.INPUT)
    public void getMessage(Message<String> message){
        System.out.println("消费者一号接到消息流水号为："+message.getPayload()+"*************当前服务端口为："+SERVER_PORT);
    }





}
